#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int a[20][20];
int main()
{
	int n;
	scanf("%d", &n);
	int x = 1, y = 1, k = 1;
	a[x][y] = k;
	while (k < n*n)
	{
		while (a[x][y + 1] == 0 && y + 1 <= n) 
		{
			k++;
			y++;
			a[x][y] = k;
		}
		while (a[x + 1][y] == 0 && x + 1 <= n) 
		{
			k++;
			x++;
			a[x][y] = k;
		}
		while (a[x][y - 1] == 0 && y - 1 >= 1)
		{
			k++;
			y--;
			a[x][y] = k;
		}
		while (a[x - 1][y] == 0 && x - 1 >= 1)
		{
			k++;
			x--;
			a[x][y] = k;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
			printf("%3d", a[i][j]);
		printf("\n");
	}
	return 0;
}